home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 31
/
Aminet 31 (1999)(Schatztruhe)[!][Jun 1999].iso
/
Aminet
/
dev
/
c
/
GAPLib.lha
/
GAPLib_Beta
/
utility
/
report.doc
< prev
next >
Wrap
Text File
|
1999-03-13
|
4KB
|
183 lines
TABLE OF CONTENTS
report/--background--
report/--format--
report/DoReport
report/EndReport
report/MakeReport
report/--background-- report/--background--
PURPOSE
To enable easy generation of data files for GAP-Lib.
OVERVIEW
Report generation utility code for GAP-Lib.
The report utility package consists of three functions, one to
initialize a report structure, one to write data to any report files
and one to free resources allocated by the other two functions. The
useage should be fairly obvious and the function and format descriptions
will now follow after just one further ado.
EXAMPLE
This example outlines the useage of the report function, in this
case two report files will be generated - "example.avg" and
"example.max".
Example code:
#include <GAP.h>
#include "report.h"
int main(void)
{
struct Report *Rep;
struct Population *Pop;
...
Rep = MakeReport("example");
if(Rep!=NULL) {
...
Pop = Evolve(Pop,Tags);
DoReport(Rep,Pop,AVERAGE|MAX);
...
EndReport(Rep);
}
...
}
report/--format-- report/--format--
OVERVIEW
The data format output by DoReport() is indeed very simple. It consists
of two columns of data in human-readable form. The first column is the
generation and the second the data value itself. Furthermore, at the
top of each file there is a one line comment describing the content of
the columns.
The reason for choosing this format is one one hand that it is
simple to work with, and on the other hand to be compatible with
gnuplot.
DESCRIPTION
The data format is as follows (Well, actually the format for TypeCount
is <Integer> <Integer>, but it does not hurt to treat it as double):
#Generation, <Data>
<Integer> <Double>
...
...
<Integer> <Double>
EXAMPLE
Sample datafile:
#Generation, Average
1 28.23554
2 29.45442
3 31.13943
4 31.64233
5 31.88642
6 33.19521
7 35.16777
8 35.74699
9 36.77469
10 37.45532
report/EndReport report/EndReport
NAME
EndReport -- Free a report structure.
SYNOPSIS
void EndReport(struct Report *);
EndReport(Rep);
FUNCTION
Frees all resources associated with a report structure and flushes
output.
INPUTS
Rep - The report structure to be deallocated.
RESULT
None.
BUGS
None known.
SEE ALSO
MakeReport(), DoReport()
report/DoReport report/DoReport
NAME
DoReport -- Write report data from a population structure.
SYNOPSIS
void DoReport(struct Report *,struct Population *,unsigned long int);
DoReport(Rep,Pop,Flags);
FUNCTION
Writes poulation data to a set of report files.
INPUTS
Rep - The report structure in question.
Pop - The population to retrieve the data from.
Flags - A set of flags which determine which data to write.
Available flags are:
AVERAGE - Average fitness.
MEDIAN - Median fitness.
TYPECOUNT - Count of most common fitness value.
STDDEV - Standard Deviation.
MAX - Maximum fitness.
MIN - Minimum fitness.
ALL - All the above.
Flags are combined by OR:ing them together and e.g.
AVERAGE|MAX would mean write average and maximum fitness
to the report files.
RESULT
None.
BUGS
None known.
SEE ALSO
MakeReport(), EndReport()
report/MakeReport report/MakeReport
NAME
MakeReport -- Initialize a report structure and return it.
SYNOPSIS
struct Report *MakeReport(char *);
Rep = MakeReport(Basename);
FUNCTION
This function will initialize a report structure and open
report files for writing. Basename is the first part of the
filenames used for the data. The actual filenames are formed by
appending a suitable suffix to the basename such as ".max" for
maximum fitness data.
INPUTS
Basename - The main part of the names of the report files.
RESULT
An initialized report structure or NULL if an error occured.
BUGS
None known.
SEE ALSO
DoReport(), EndReport()